package ATM;

import javax.swing.*;
import java.awt.*;

public class ATMJframe extends JFrame {
    private Image background = Util.getimages("/images/background.jpg");

    private LogJpanel logJpanel = new LogJpanel(this);

    private MenuJpanel menuJpanel = new MenuJpanel(this);
    private SaveJpanel saveJpanel = new SaveJpanel(this);
    private FindJpanel findJpanel = new FindJpanel(this);
    private GetJpanel getJpanel = new GetJpanel(this);


    private CardLayout cardLayout = new CardLayout();

    public ATMJframe() {

        this.setContentPane(new JPanel() {
            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                g.drawImage(background, 0, 0, 1042, 768, this);
            }
        });
        this.setLayout(cardLayout);
        this.add("log", logJpanel);
        this.add("menu", menuJpanel);
        this.add("save", saveJpanel);
        this.add("find", findJpanel);
        this.add("get", getJpanel);


        this.setSize(1042, 768);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setTitle("ATM");
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new ATMJframe();
    }

    public void switchPanel(String name) {
        cardLayout.show(this.getContentPane(), name);
    }

}
